You've stumbled across the archive of the blog posts I wrote back in 2014 and prior. Feel free to peruse, through everything from code snippets that never made it to GitHub, to random ramblings about my passion for technology.

Sometimes, we need to get a resource from the Android resource library without knowing its name. Perhaps we have R.id.data1 through R.id.data9 and want to fetch all 9 of them without hardcoding each one.

This has been possible since API 1, through the use of getIdentifier(). I will start off by saying that this is not as efficient as referencing R, so it should be used ONLY in the event that you cannot be sure of the ID you are fetching.

Continue reading...